package com.webapp.module;

import java.io.File;

import org.jdom.Element;

import com.webapp.loader.XmlReportsLoader;

public class Report
{
  private String id;
  private String searchpath;
  private String savefolder;
  private String saveSheetfolder;
  private String copyfolder;
  private String prefixFilename;
  private String fileFormat;
  private MailSubscriber mail;
  private int retryNum;

  public Report(Element root)
  {
    this.id = root.getAttributeValue("id");
    this.searchpath = root.getChildText("searchpath");
    this.savefolder = root.getChildText("savefolder");
    this.copyfolder = root.getChildText("copyfolder");
    this.prefixFilename = root.getChildText("prefixFilename");
    this.fileFormat = root.getChildText("fileFormat");
    this.mail = new MailSubscriber(root.getChild("mailsubscriber"));
    this.retryNum=0;
  }
  public void addRetry(){
	  retryNum=retryNum+1;
  }
  public String getSearchpath() {
    return this.searchpath; }

  public void setSearchpath(String searchpath) {
    this.searchpath = searchpath; }

  public String getSavefolder() {
    return this.savefolder; }

  public void setSavefolder(String savefolder) {
    this.savefolder = savefolder; }

  public String getPrefixFilename() {
    return this.prefixFilename; }

  public void setPrefixFilename(String prefixFilename) {
    this.prefixFilename = prefixFilename;
  }

  public MailSubscriber getMail() {
    return this.mail;
  }

  public void setMail(MailSubscriber mail) {
    this.mail = mail;
  }

  public String getId() {
    return this.id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getCopyfolder() {
    return this.copyfolder;
  }

  public void setCopyfolder(String copyfolder) {
    this.copyfolder = copyfolder;
  }

  public String getFileFormat() {
    return this.fileFormat;
  }

  public void setFileFormat(String fileFormat) {
    this.fileFormat = fileFormat;
  }

public int getRetryNum() {
	return retryNum;
}

public void setRetryNum(int retryNum) {
	this.retryNum = retryNum;
}
public String getSaveSheetfolder() {
	return saveSheetfolder;
}
public void setSaveSheetfolder(String saveSheetfolder) {
	this.saveSheetfolder = saveSheetfolder;
}
public  String getHKSaveSheetPath(){
	  String savepath = XmlReportsLoader.getREPORT_ROOT();
	  savepath = savepath + File.separator + this.savefolder + File.separator + this.saveSheetfolder;
	  return savepath;
}

}